<template>
  <div class="app-container">
    <el-tabs v-model="activeName" @tab-click="handleClick">
      <el-tab-pane label="待处理" name="first">
        <item ref="item" />
      </el-tab-pane>
      <el-tab-pane label="已处理" name="second">
        <item ref="item2" finish/>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>

<script>
import item from "./item";
export default {
  name: "user-index",
  components: { item},
  data() {
    return {
      activeName: "first",
      secondInit: true,
    };
  },
  created() {
    this.$nextTick(() => {
      this.$refs.item.init();
    });
  },
  methods: {
    handleClick(tab, event) {
      if (this.secondInit && this.activeName == "second") {
        this.secondInit = false;
        this.$refs.item2.init();
      }
    },
  },
};
</script>
